home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
comm
/
tlx_sq21.zip
/
DNLOAD.SLT
< prev
next >
Wrap
Text File
|
1992-03-20
|
26KB
|
771 lines
//-----------------------------------------------------------
// DNLOAD.SL? Automatic download from BBS systems.
str dll_file [] = "DOWNLOAD"; // Download log file.
str filelist [] = "FILELIST.BBS";// Name of file containing filenames.
int MinLeft = 5; // Minimum time left for download.
//-----------------------------------------------------------
// The file <BBS>.DL must be placed in TELIX's program (main)
// directory. <BBS> consists of the first 8 (max.) alphabetic
// characters of the BBS name.
// The following parameters must be defined in this file:
// Filename to download.
// Filename to download
// etc.
// Example:
// GAME1.ZIP
// GAME2.ZIP
// GRAPHICS.ZIP
// You may specify as many files as you want. However, the
// script attempts to download only 10 files. The script does
// not attempt to download files that are already in the download
// directory. Thus you may run the script repeatedly to download
// more files (if you have enough file time) without having to
// modify the specification file manually.
// These files are downloaded to the directory defined for
// this purpose in TELIX. You may NOT specify directory
// (path) in the download specifications.
// Hint: Define a softkey to trigger this file (define in NAME.DAT)
//-----------------------------------------------------------
// If you have suggestions for improving this script, please suggest
// improvements to me via old-fashioned snail-mail to:
// Author: Inge Vabekk
// Hamangskogen 108
// N-1300 SANDVIKA
// NORWAY
// tel. (472) 546 396
str dls_file [14] // Download specifications
,NextConf [14] // Next conference
,PrevConf [14] // Previous conference
,filist [30] // Name of filelist.
,myprot [2] // "My" protocol
,hisprot [2] // The BBS's protocol
,shortname [8] // Short name of BBS.
,input [144] // Input line.
,f0 [14] // Filename for download.
,command [10] // Command prompt.
,temp [4] // Temporary for short strings.
,password [14] // Password for file download.
// For the Global storage:
,global []="GLOBAL" // Global script.
,PutLine []="PUTLINE" // Put Line script.
,UpDownF []="UPDOWNF" // Upload/Download script.
,bbsname []="BNAME" // BBS name.
,bbstype []="BTYPE" // BBS type.
,short []="SHORT" // Short BBS name.
,Cprot []="CPROT" // Current protocol.
,Hprot []="HPROT" // "His" protocol.
,version []="BBSver" // PCB version
,conf []="CONF" // Current conference
,ConfList []="CNFLST" // YES if conference list wanted.
,prompt []="PROMPT" // Current command prompt.
,maxdn []="MAXDN" // Max. files for download.
,fpass []="FPASS" // Password for downloading.
;
// Other constants and variables.
int tol = 300 // timeout limit 30 sec.
,tmark, stat
,mbbs, pcb, rbbs, opus, fido, crcs // Possible BBS types
,BBSver // PCBoard version.
,infile // Input file pointer
,infilemenu // TRUE if in file menu
,success // Count of succesful downloads.
,fail = 0 // Number of failures.
,MAX // Max # files to download
,MORE // More files to download
,switched // TRUE (1) if conferences switched.
,protocol // Must be INT.
,error // General error indicator
,Enter = 13 // Code for CR.
;
//-----------------------------------------------------------
// DNload script starts here.
//-----------------------------------------------------------
main()
{
int c, i, k; // Temporary storage.
entry(); // Updates colors & status bar.
// Check if online.
//-----------------------------------------------------------
if (!carrier())
{ tone (150,50); // No, failure.
status_wind ("T²: YOU CAN ONLY DOWNLOAD IF YOU'RE ONLINE!",20);
return (-1);
}
// Find BBS type (Set one logical variable).
read (bbstype,input); // Get BBS type,
mbbs = pcb = rbbs = opus = fido = crcs = 0;
if (input == "MBBS") mbbs = 1;
else if (input == "PCB" ) pcb = 1;
else if (input == "RBBS") rbbs = 1;
else if (input == "OPUS") opus = 1;
else if (input == "FIDO") fido = 1;
else if (input == "CRCS") crcs = 1;
else
{ wrongBBS(input); // Doesn't match script!
return (-1);
}
read (version,temp);
BBSver = subchr (temp,0); // BBS version.
read (prompt,command); // Get command prompt.
read (cprot,myprot); // Protocol.
protocol = toupper(subchr(myprot,0));
read (hprot,hisprot); // His protocol.
if (pcb) NextConf = "Main Board"; // Join Main conference.
read (conf,PrevConf); // Get current conference.
switched = 0;
read (short,shortname); // Get the short name and build
dls_file = shortname; // name of download spec. file.
strcat (dls_file,".DL"); // Add extension.
newdir (_telix_dir); // Go back to TELIX directory.
infile = filesize(dls_file); // Check if download file exists.
if (infile < 0) // If not,
{ if (!timeleft(MinLeft))
return (99); // Not enough time left.
exec ("HAVEIT$",shortname); // run program to build it.
infile = filesize(dls_file); // Check result.
}
else if (!timeleft(MinLeft))
goto done; // Not enough time left.
if (infile > 0)
infile = fopen (dls_file,"r"); // Open file for READ.
if (infile <= 0) goto done; // No file???
read (maxdn,temp);
MORE = MAX = stoi (temp); // Max. files to download.
success = 0; // No files so far.
infilemenu = 0; // NOT in file menu yet.
while ((error=fgets (input,144,infile)) > 0 // Download files.
&& MORE
&& success < MAX
&& carrier()
&& strlen(input) > 3 // Sensible input
&& timeleft(MinLeft))
{ k = -1;
for (i=0; (c=subchr(input,i)) > 0; ++i)
{ c = toupper(c);
if (c > ' ')
{ if (k < 0) // First character:
{ if (c=='#' || c=='+' || c=='-' || c=='&')
continue;
}
setchr (f0,++k,c); // ANY char. > space)
}
else if (k > 1)
break; // Filename ended.
}
setchr (f0,++k,0); // End of string.
for(i=0; (c=subchr(input,i))<=' '; ++i)
if (!c) goto loop1; // Find first character.
if (c=='#' || c =='+' || c=='-') // Change conference?
{ substr (input,++i,14,NextConf); // Copy conference name.
setconf(c); // Set conference.
}
else if (c=='&') // Password?
{ substr (input,++i,14,password); // Copy password.
write (fpass,password); // Update password.
}
else
if (k > 1) DL(); // Download this file....
loop1:
continue;
} // Read next input line.
fclose (infile); // Close the command file.
done:
fdelete (dls_file);
if (!carrier()) return (-1);
if (!timeleft(MinLeft))
return (99); // No more time left.
return(0);
}
//-----------------------------------------------------------
// Download one file. All systems.
//---------------------------------------------------------